package com.gorkr.labuladong.data_struct.array;

/**
 * @author gorkr
 * @date 2022/06/03 11:06
 **/
public class E283MoveZeros {

    // 在剔除0的基础上 末尾填充0
    public void moveZeroes(int[] nums) {
        int low = 0, fast = 0;

        while(fast<nums.length){
            if(nums[fast]!=0){
                nums[low]=nums[fast];
                low++;
            }
            fast++;
        }
        for (int i = low; i <fast; i++) {
            nums[low] = 0;
        }
    }
}
    